//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __CDIRENUMERATOR_H__
#define __CDIRENUMERATOR_H__

#include <elasys_server.h>
#include <stdlib.h>

class CDirEnumerator : public IWStringEnumerator
{
public:
    CARAPI_(PInterface) Probe(
         /* [in]  */ REIID riid);

    CARAPI_(UInt32) AddRef(void);

    CARAPI_(UInt32) Release(void);

    CARAPI Aggregate(
        /* [in] */ AggrType aggrType,
        /* [in] */ PInterface pObject);

    CARAPI GetDomain(
         /* [out] */ PInterface *ppObj);

    CARAPI Current(
        /* [out] */ WStringBuf * pPsa);

    CARAPI MoveNext();

    CARAPI Reset();

public:
    CDirEnumerator();
    ECode Initialize(wchar_t *pPathName);
    virtual ~CDirEnumerator();

private:
    wchar_t      *m_pPathName;
    wchar_t      m_FileName[_MAX_PATH];
    Boolean      m_bReset;
    Boolean      m_bMove;
    PVoid        m_hFile;
    Interlocked   m_cRef;
};

#endif

